{include file="public/header" /}
{load href="__PLUGINS__bootstrap/bootstrap-table.min.css"}
{load href="__PLUGINS__bootstrap/bootstrap-table.min.js"}
<style type="text/css">
#des,#des input{ width: 40px;text-align:center;}
#id{ width: 78px; }
.bs-checkbox{ width: 36px; height: 40px }
.fixed-table-toolbar .columns,.fixed-table-toolbar .search{margin-left:0px; margin-top: 0px }
#title span{ float: right; }
.asdlkjasd{ background: #1ab394; color: #fff}
</style>
 <body class="gray-bg">
 <div class="wrapper wrapper-content {:config('adminClass.main')}">
    <div class="ibox float-e-margins">
        {include file="public/tophead"}
        {include file="public/top" /}
        <div class="ibox-content">
        {include file="public/topsection"}
            <div class="row row-lg">
                <div class="col-sm-12">
                    <div class="fixed-table-toolbar">
                        <a class="btn btn-default btn-outline {present name="type"}{else /}asdlkjasd{/present}" href="{:url('xuni')}">所有用户</a>
                        <a class="btn btn-default btn-outline {eq name='type' value='1'}asdlkjasd{/eq}"  href="{:url('xuni',['type'=>'1'])}">付费会员</a>
                        <a class="btn btn-default btn-outline {eq name='type' value='2'}asdlkjasd{/eq}" href="{:url('xuni',['type'=>'2'])}">视频认证(女)</a>
                        <a class="btn btn-default btn-outline {eq name='type' value='3'}asdlkjasd{/eq}" href="{:url('xuni',['type'=>'3'])}">今日注册</a>
                        <a class="btn btn-default btn-outline {eq name='type' value='4'}asdlkjasd{/eq}" href="{:url('xuni',['type'=>'4'])}">男性用户</a>
                        <a class="btn btn-default btn-outline {eq name='type' value='5'}asdlkjasd{/eq}" href="{:url('xuni',['type'=>'5'])}">女性用户</a>
                    </div>
                    <div style="display:block;clear: both;"></div>
                    <div class="fixed-table-toolbar">
                        <form  method="get" action="">
                            <div class="pull-left search">
                                <div class="columns columns-right btn-group pull-left">
                                    <select class="form-control" name="search">
                                        <option value="id" {php}if(input('?param.type')){if(input('param.type')=='id'){echo "selected";} }{/php}>会员ID</option>
                                        <option value="name" {php}if(input('?param.type')){if(input('param.type')=='name'){echo "selected";} }{/php}>昵称</option>
                                        <option value="phone" {php}if(input('?param.type')){if(input('param.type')=='phone'){echo "selected";} }{/php}>手机</option>
                                    </select>
                                </div>
                                {php}
if(input('?param.name')){
{/php} 
<div class="pull-right search">
    <a class="btn btn-w-m btn-link" href="{:url('xuni')}">返回用户管理</a>
</div>{php}
}
{/php}
                                <div class="pull-right search">
                                    <button style="border-radius:0px; border:1px solid #e5e6e7; border-left:0px" class="btn btn-default btn-outline" type="submit">搜索</button>
                                </div>
                                <div class="pull-right search">
                                    <input class="form-control input-outline" type="text"
{php}
if(input('?param.name')){
            if(input('param.name')){
               echo "value='".input('name')."'";
            } 

        }
{/php}
                                     name="name" placeholder="搜索会员">
                                </div>
                                

                            </div>
                        </form>
                    </div>
                    <div class="example">
                        <form class="form-horizontal" method="post">
                        <table data-toggle="table">
                            <thead>
                                <tr>
                                    <th data-align="center">ID</th>
                                    <th data-align="center">头像</th>                               
                                    <th data-align="center">昵称</th>
                                    <th data-align="center">性别</th>                   
                                    <th data-align="center">手机</th>
                                    <th data-align="center">余额(元)</th>
                                    <th data-align="center">邀请人</th>      
                                    <th data-align="center">邀请码</th>
                                    <th data-align="center">会员到期时间</th>
                                    <th data-align="center">添加会员</th>
                                    <th data-align="center">视频认证</th>             
                                    <th>最后登录时间</th>
                                    <th>管理</th>
                                </tr>
                            </thead> 
                            <tbody id="form">
                                {php}$hide=array('0'=>'<font color="#f00">禁止</font>','1'=>'<font color="#1ab394">正常</font>','2'=>'审核','3'=>'<font color="#f00">拒绝</font>');{/php}
                                {volist name="data" id="v"}
                                <tr id="id{$v.id}" class="class">
                                    <td>{$v.id}</td>
                                    <td>
                                        <a href="__ROOT__{$v.head_portrait}" title="{$v.name}" target="_blank">
                                            <img style="width:40px;height:40px;" src="__ROOT__{$v.head_portrait}"/>
                                        </a>
                                    </td>
                                    <td>{$v.name}</td>
                                    <td>{$v.sex}</td>                                    
                                    <td>{$v.phone}</td>
                                    <td>{$v.volley}</td>
                                    <td>{:yqmuser($v.yqr)}</td>
                                    <td>{$v.yqm}</td>
                                    <td>
                                        {eq name="$v.sex" value="男"}
                                        <?php 
                                            if(strtotime($v['vip_end_datetime']) >= time()){
                                                echo $v['vip_end_datetime'];
                                            }else{
                                                echo "未购买会员";
                                            }
                                        ?>
                                        {/eq}
                                    </td>
                                    <td>
                                    {eq name="$v.sex" value="男"}
                                    <span onClick="huiyuan(this,{$v.id})" style="color:#40BCF7;cursor:pointer;">添加会员</span>
                                    {/eq}
                                    </td>
                                    <td> 
                                        {eq name="$v.sex" value="女"}
                                        {if condition="!$v.is_identity_authentication"}
                                            <a style="color:#40BCF7;cursor:pointer;" href="{:url('revideoadd',['id'=>$v['id']])}">未认证</a>
                                        {elseif condition="$v.is_identity_authentication == 1"}
                                            <a style="color:#40BCF7;cursor:pointer;" href="{:url('revideoadd',['id'=>$v['id']])}">待审核</a> 
                                        {elseif condition="$v.is_identity_authentication == 2"}
                                            认证通过
                                        {elseif condition="$v.is_identity_authentication == 3"}
                                            认证未通过
                                        {/if}
                                        {/eq}
                                    </td>            
                                    <td>{$v.last_login_datetime}</td>
                                    <td>
                                        <div class="btn-group">
                                            <div data-toggle="dropdown" class="btn btn-primary btn-xs dropdown-toggle">
                                                操作 <span class="caret"></span>
                                            </div>
                                            <ul class="dropdown-menu">
                                                <li><a onClick="add('{:url('money',['id'=>$v['id'],'url'=>-1])}')">账户充值</a>
                                                </li>
                                                <li class="divider"></li>
                                                <li><a onClick="add('{:url('addvideo',['id'=>$v['id'],'url'=>-1])}')">上传视频</a></li>
                                                <li><a onClick="add('{:url('addimage',['id'=>$v['id'],'url'=>-1])}')">上传照片</a></li>
                                                <li><a onClick="add('{:url('image',['id'=>$v['id'],'url'=>-1])}')">查看照片</a></li>
                                                </li>
                                                <li class="divider"></li>
                                                <li><a onClick="add('{:url('add',['id'=>$v['id'],'url'=>-1])}')">修改资料</a>

                                                </li>
                                                <li class="divider"></li>
                                                <li><a onClick="del({$v.id})">删除账号</a>
                                                </li>
                                            </ul>
                                        </div>
                                    </td>
                                </tr>
                                {/volist}
                            </tbody>
                        </table>
                        </form>
                    </div>
                </div>  
            </div>
            <hr>
            <div class="row row-lg">
                <div class="col-sm-12 pages">{$page}</div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}

<div id="xuanze" style="text-align:center;display:none;">
    <i style="font-size:5px;color:red;">选择其中一个会员，点击确定即可为用户添加对应的会员</i>
    <br/>
    <p></p>
    <?php foreach($vip as $k=>$v){ ?>
        <input type="radio" name="huiyuan" value="{$v.chang}" checked="checked" id="{$v.chang+1}" style="cursor:pointer;"><label for="{$v.chang+1}"  style="cursor:pointer;"><?php if($v['chang']==0){echo "7天";}else if($v['chang']==1){echo "一个月";}else if($v['chang']==2){echo "三个月";}else if($v['chang']==3){echo "半年";}else if($v['chang']==4){echo "一年";}else if($v['chang']==5){echo "永久";} ?></label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <?php } ?>
</div>






<script type="text/javascript">
function del(id){
    swal_del(id,"{:url('del')}")
}

    function huiyuan(obj,id){
        var index = layer.open({
            area:['600px','180px'], 
            type:1,
            title:'选择会员',
            content:$('#xuanze'),
            btn:['确定','取消'],
            yes:function(index,layero){ 
                var h = $("input[name='huiyuan']:checked").val();
                $.ajax({
                    type:'POST',
                    url:"{:url('admin/admin/addhuiyuan')}",
                    data:{type:h,id:id}, 
                    dataType:'json', 
                    success:function(date){
                        if(date.state){
                            layer.msg(date.msg,{icon:1}); 
                            layer.close(index); 
                        }else{
                            layer.msg(date.msg,{icon:0});
                            layer.close(index);
                        }
                    }, 
                    error:function(e){ 
                        alert(e.responseText);
                    }
                });

            }
        })
    }
 
</script>
 